import { trimPhone } from "./format";
/**
 * @description 校验连接是否是外链
 * @author created by 孔东
 * @date 2023-07-14 14:29:27
 * @export
 * @param {string} [url]
 * @returns {*}  {boolean}
 */
export function isExternal(url?: string) {

  if (url) {
    return /^(http|https):\/\/.*/.test(url);
  }
  return false;
}

/**
 * 校验是否满足手机号规则
 * @param {string} phone 手机号
 */

export function validatorPhone(phone?: string) {
  if (phone) {
    phone = trimPhone(phone);
    return /^(?:(?:\+|00)86)?1\d{10}$/.test(phone);
  }
  return false;
}